forum

home / developersection / forums / how can i convert ienumerable<t> to list<t> in c#?

How can I convert IEnumerable<T> to List<T> in C#?

Anonymous User 3997 14-Nov-2013

I am using LINQ to query a generic dictionary and then use the result as the datasource for my ListView.

Dictionary<Guid, Record> dict = GetAllRecords();

List<Record> searchResults = new List<Record>();

var matches = dict.Values.Where(rec => rec.Name == "foo");

foreach (Record rec in matches)

    searchResults.Add(rec);

myListView.DataSource = searchResults;

myListView.DataBind();


c# c# 
Updated on 14-Nov-2013

I am a content writter !


Message
Can you answer this question?

Answer

1 Answers

Liked By